/*********************************************************
          File Name:11.4.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Sun 20 Sep 2015 07:22:38 PM CST
**********************************************************/

#include <iostream>
#include <string>
#include <map>
#include <set>
#include <cctype>

using std::map;
using std::string;
using std::set;

void to_lower(string &s)
{
        for(auto &x: s)
        {
                x = tolower(x);
        }
}

auto word_count(void) -> map<string, size_t>
{
        set<char> including = {'.', ','};
        map<string, size_t> count;
        string word;

        while(std::cin >> word)
        {
                to_lower(word);
                if(including.find(word[word.length() - 1]) != including.end())
                        word.erase(word.length() - 1, 1);
                ++count[word];
        }

        return count;
}

int main()
{
        auto count = word_count();

        for(const auto &x: count)
        {
                std::cout << "\"" << x.first << "\""
                        << " occurs " << x.second << " time(s)\n";
        }

        return 0;
}
